"use strict";
const a = require("../../common/vendor.js"),
  e = require("../../api/request.js"),
  t = {
    __name: "my-activities",
    setup(t) {
      const i = a.ref([{
          api: "/par_in_activities",
          name: "我参与的"
        }, {
          api: "/my_in_activities",
          name: "我发起的"
        }]),
        n = a.ref([]),
        u = a.ref(!1);
      async function o(a) {
        s.value = 1;
        const t = await e.requestApi(a, {
          page: 1
        });
        console.log(t), n.value = t.data, u.value = !(t.data.length > 0)
      }
      a.onLoad((async () => {
        await o(i.value[0].api)
      }));
      const r = a.ref(0),
        c = a.ref(0);
      const s = a.ref(1);

      function l() {
        a.wx$1.navigateTo({
          url: "/pages/companion/Init-partner"
        })
      }
      return a.onReachBottom((async () => {
        s.value++;
        const a = await e.requestApi(i.value[r.value].api, {
          page: s.value
        });
        n.value = [...n.value, ...a.data]
      })), (e, t) => a.e({
        a: a.f(i.value, ((e, t, n) => ({
          a: a.t(e.name),
          b: c.value === t ? 1 : "",
          c: c.value === t ? 1 : "",
          d: t,
          e: t,
          f: a.o((a => async function (a) {
            r.value = a, c.value = a, await o(i.value[a].api)
          }(t)), t)
        }))),
        b: a.f(n.value, ((e, t, i) => ({
          a: e.author_data[0].avatarUrl,
          b: a.t(e.author_data[0].nickname),
          c: a.t(e.timestamp),
          d: a.t(e.description),
          e: a.t(e.companion_time),
          f: a.t(e.city),
          g: a.t(e.full_address),
          h: a.f(e.image, ((t, i, n) => ({
            a: i,
            b: t,
            c: a.o((i => function (e, t) {
              a.wx$1.previewImage({
                current: t,
                urls: e
              })
            }(e.image, t)), i)
          }))),
          i: a.t(e.count),
          j: t,
          k: a.o((t => {
            return i = e._id, void a.wx$1.navigateTo({
              url: "/pages/companion/partner-details?_id=" + i
            });
            var i
          }), t)
        }))),
        c: u.value
      }, (u.value, {}), {
        d: a.o(l)
      })
    }
  };
wx.createPage(t);